import { $get, $put } from '@js/request'
import { DataNode } from 'rc-tree-select/lib/interface'
import { EmployeeSchema } from '@src/components/schema/employeeSchema'

// 获取案由树
export async function getTreeRequest (): Promise<DataNode[]> {
  const res = await $get('/api/commission/cause_action')
  return res.data
}

// 获取秘书列表
export async function getPersonList (): Promise<string[]> {
  const res = await $get('/api/common/employee', { page: 1, limit: 1000 })
  return res.data.list.map((li: EmployeeSchema) => li.realname)
}

// 更新案件数据
export async function updateCaseRequest (id: string, data: { [k: string]: any }): Promise<void> {
  const res = await $put(`/api/common/input_excel/case_temp_update/${id}`, data)
  return res.data
}
